﻿@model PagedList<kxcxw.Data.Entities.SysUserInfo>
@{
    ViewBag.Title = "Index";
    Layout = "~/Areas/Admin/Views/Shared/_UserInfoLayout.cshtml";
}
<h2>
    @Html.ActionLink("用户管理", "Index") &raquo; @Html.ActionLink("用户列表", "Index", null, new { @class = "active" })</h2>
<div id="main">
    <table cellspacing="0" cellpadding="0">
        <tbody>
            <tr>
                <th>
                    @Html.ActionLink("用户名", "Index", new { sortOrder = ViewBag.NameSortParm })
                </th>
                <th>
                    昵称
                </th>
                <th>
                    联系电话
                </th>
                <th>
                    @Html.ActionLink("注册时间", "Index", new { sortOrder = ViewBag.DateSortParm })
                </th>
                <th>
                    最后一次登录
                </th>
                <th>
                    登录次数
                </th>
                <th>
                    操作
                </th>
            </tr>
            @foreach (var item in Model)
            {
                <tr>
                    <td>
                        @Html.DisplayFor(modelItem => item.UserName)
                    </td>
                    <td>
                        @Html.DisplayFor(modelItem => item.NickName)
                    </td>
                    <td>
                        @Html.DisplayFor(modelItem => item.Tel)
                    </td>
                    <td>
                        @if (item.RegistrDate.HasValue)
                        {
                            @string.Format("{0:yyyy-MM-dd}", DateTime.Parse(@Html.DisplayFor(modelItem => item.RegistrDate).ToString()))
                        }
                    </td>
                    <td>
                        @Html.DisplayFor(modelItem => item.LastLoginDate)
                    </td>
                    <td>
                        @Html.DisplayFor(modelItem => item.LoginNumber)
                    </td>
                    <td class="action">
                        @Html.ActionLink("修改", "Edit", new { id = item.UserID }, new { @class = "edit" })
                        |
                        @Html.ActionLink("查看", "Details", new { id = item.UserID }, new { @class = "view" })
                        |
                        @Html.ActionLink("删除", "Delete", new { id = item.UserID }, new { @class = "delete" })
                    </td>
                </tr>
            }
        </tbody>
    </table>
    <p>
        共有 @Model.TotalItemCount 条记录 @Model.CurrentPageIndex/@Model.TotalPageCount</p>
    @Html.Pager(
 Model, new PagerOptions
 {
     PageIndexParameterName = "page",
     FirstPageText = "首页",
     LastPageText = "尾页",
     NextPageText = "后一页",
     PrevPageText = "前一页",
     ShowPageIndexBox = true,
     PageIndexBoxType = PageIndexBoxType.TextBox,
     PageIndexBoxWrapperFormatString = "请输入页数{0}"
 }, "Admin_default",
    new { sortOrder = ViewBag.DateSortParm, searchString = ViewBag.Filter }
    )
</div>
<script type="text/jscript">
    $(function () {
        $(".delete").click(function () {
            if (confirm("确定要删除这条记录么？")) {
                alert("删除成功");
            }
            else {
                return false;
            }
        });
    }); 
</script>
